
template<typename T, int CHUNK_SIZE>
ObjPool<T,CHUNK_SIZE>::ObjPool()
{
	AllocateChunk();
}

template<typename T, int CHUNK_SIZE>
T * ObjPool<T,CHUNK_SIZE>::Create()
{
	if (m_qFreeList.empty())
	{ 
		AllocateChunk(); 
	}

	T* temp = m_qFreeList.front();
	m_qFreeList.pop();

	temp = new(temp) T();
	return temp;
}

template<typename T, int CHUNK_SIZE>
void ObjPool<T,CHUNK_SIZE>::Release(T * pT)
{
	pT->~T();
	m_qFreeList.push(pT);
}

template<typename T, int CHUNK_SIZE>
void ObjPool<T,CHUNK_SIZE>::AllocateChunk()
{
	for (int i = 0 ; i < CHUNK_SIZE ; i++)
	{
		T* pTemp = (T*)new char[sizeof(T)];
		m_qFreeList.push(pTemp);
	}

}
